<div class="vheader">
    <h1><?php echo $this->translate("Written off loan") ?></h1>
    <p><?php echo $this->translate("Loan code") ?> <?php echo $this->loan->get('LoanId') ?>
</div>

<div class="vcontent"> 
    <span class="label"><?php echo $this->translate('Client') ?>:</span> <?php echo $this->loan->get('ClientFullName') ?> -
    <span class="label"><?php echo $this->translate('Client code') ?>:</span> <?php echo $this->loan->get('ClientCode') ?> -
    <span class="label"><?php echo $this->translate('Phone number(s)') ?>:</span> 
        <?php echo $this->loan->get('ClientMobilePhone') ?> <?php echo $this->loan->get('ClientHomePhone') ?> -
    <span class="label"><?php echo $this->translate('Business') ?>:</span> <?php echo $this->loan->get('BusinessType') ?>
    <br /><br />
    
    <?php echo $this->partial('partials/table.phtml', (object) array()); ?>
    <style>
        th, td { padding: .5em 1.8em; } 
        tfoot th, td { text-align: right; }
        th.pad { padding: 0 30px 0 30px; }
        thead td { text-align: center; font-weight: normal; font-style: oblique; }
        tbody th { font-weight: normal; text-align: left; }
        .cycle { border-bottom: 1px #8ab solid; }
        .regular, .legal { background-color: #eef3f7; }
    </style>

    <table cellspacing="0">
    <thead>
        <tr class="cycle">
            <td></td>
            <td></td>
            <td class="cycle" colspan="2"><?php echo $this->translate("Regular cycle") ?></td>
            <td></td>
            <td class="cycle" colspan="2"><?php echo $this->translate("Legal cycle") ?></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Item") ?></th>
            <th class="pad"></th>
            <th class="regular"><?php echo $this->translate("Charges") ?></th>
            <th class="regular"><?php echo $this->translate("Payments") ?></th>
            <th class="pad"></th>
            <th class="legal"><?php echo $this->translate("Charges") ?></th>
            <th class="legal"><?php echo $this->translate("Payments") ?></th>
            <th class="pad"></th>
            <th><?php echo $this->translate("Balance") ?></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th><?php echo $this->translate("Principal") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('PrincipalCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('PrincipalPayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('PrincipalBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Loan insurance") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('LoanInsuranceCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('LoanInsurancePayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('LoanInsuranceBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Health insurance") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('HealthInsuranceCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('HealthInsurancePayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('HealthInsuranceBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Administrative fee") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('AdministrativeFeeCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('AdministrativeFeePayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('AdministrativeFeeBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Interest") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('InterestCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('InterestPayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('InterestBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Penalties") ?></th>
            <td></td>
            <td class="regular"><?php echo number_format($this->loan->get('PenaltiesCharges'),2,'.',','); ?></td>
            <td class="regular">-<?php echo number_format($this->loan->get('PenaltiesPayments'),2,'.',','); ?></td>
            <td></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td class="legal"><?php echo '-'; ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('PenaltiesBalance'),2,'.',','); ?></td>
        </tr>
        <tr>
            <th><?php echo $this->translate("Legal") ?></th>
            <td></td>
            <td class="regular"><?php echo '-'; ?></td>
            <td class="regular"><?php echo '-'; ?></td>
            <td></td>
            <td class="legal"><?php echo number_format($this->loan->get('LegalCharges'),2,'.',','); ?></td>
            <td class="legal">-<?php echo number_format($this->loan->get('LegalPayments'),2,'.',','); ?></td>
            <td></td>
            <td><?php echo number_format($this->loan->get('LegalBalance'),2,'.',','); ?></td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <th><?php echo $this->translate("Total") ?></th>
            <th></th>
            <th class="regular"><?php echo number_format($this->loan->get('RegularCharges'),2,'.',','); ?></th>
            <th class="regular">-<?php echo number_format($this->loan->get('RegularPayments'),2,'.',','); ?></th>
            <th></th>
            <th class="legal"><?php echo number_format($this->loan->get('LegalCharges'),2,'.',','); ?></th>
            <th class="legal">-<?php echo number_format($this->loan->get('LegalPayments'),2,'.',','); ?></th>
            <th></th>
            <th><?php echo number_format($this->loan->get('TotalBalance'),2,'.',','); ?></th>
        </tr>
    </tfoot>
</table>
    
</div>

<div class="vfooter">
    <div class="menu">
        <?php echo $this->link('/loan/loan-master/view', array('id'=>$this->loan->get('LoanMasterId')),$this->translate("Master")) ?>
        <?php echo $this->link('/loan/loan/view', array('id'=>$this->loan->get('LoanId')),$this->translate("Loan")) ?>
        <?php echo $this->link('/loan/loan/status-changes', array('id'=>$this->loan->get('LoanId')),$this->translate("Status changes")) ?>
        <?php echo $this->link('/loan/loan/plan', array('id'=>$this->loan->get('LoanId')),$this->translate("Payment plan")) ?>
        |
        <?php echo $this->link('/loan/loan/write-off-charges', array('id'=>$this->loan->get('LoanId')),$this->translate("Legal charges")) ?>
        <?php echo $this->link('/loan/loan/write-off-payments', array('id'=>$this->loan->get('LoanId')),$this->translate("Legal payments")) ?>
        |
        <?php if($this->loan->get('Status') == 'Written-Off'): ?>
            <?php echo $this->link('/loan/write-off-charge/add', array('loan'=>$this->loan->get('LoanId')),$this->translate("Add legal charge")) ?>
            <?php echo $this->link('/loan/write-off-payment/add', array('loan'=>$this->loan->get('LoanId')),$this->translate("Add legal payment")) ?>
            |
        <?php endif; ?>
        <?php echo $this->printLink() ?> 
    </div>
</div>